package com.file.controller;

import com.file.service.FileService;
import com.file.vo.PageResult;
import com.file.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/file")
@CrossOrigin(origins = "*")
public class FileController {

    @Autowired
    private FileService fileService;

    //分页展示文件列表
    @GetMapping("/list")
    public SysResult getUserList(PageResult pageResult){
        pageResult = fileService.selectFile(pageResult.getPageNum(),pageResult.getPageSize(), pageResult.getQuery());
        return SysResult.success(pageResult);
    }

    //删除文件信息
    @DeleteMapping("/delete/{id}")
    public SysResult deleteUser(@PathVariable Integer id){
        fileService.deleteFileById(id);
        return SysResult.success();
    }
}
